package com.java46.struts2.orderdetails.service;

import com.java46.struts2.base.exception.BusinessException;
import com.java46.struts2.orderdetails.dao.OrderDetailsDao;

import java.util.List;

/**
 * @ClassName OrderDetailsService
 * @Description 订单详情逻辑处理
 * @Author zuxia
 * @Date 2018/7/18 10:44
 * @Vcrsion 1.0
 **/
public class OrderDetailsService {

    /**
    *@Author xiao
    *@Description //根据订单编号查询订单详情
    *@Date 11:07 2018/7/18
    *@Param [orderid]
    *@return java.util.List
    */
    public static List queryDetailsOrderid(String orderid){
        int orderId;
        if(orderid==null||orderid.trim().equals("")){
            throw new BusinessException("订单编号为空");
        }
        try {
            orderId=Integer.parseInt(orderid);
        }catch (Exception e){
            throw  new BusinessException("订单编号格式不正确");
        }
        List list = OrderDetailsDao.queryDetailsOrderid(orderId);
        if(list.isEmpty()){
            throw new BusinessException("没有查询到任何订单详情数据");
        }
        return  list;
    }


}
